package com.kgc.onlineLife.service.impl;

import com.kgc.onlineLife.bean.User;
import com.kgc.onlineLife.mapper.UserMapper;
import com.kgc.onlineLife.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpSession;

/**
 * @program: com.kgc.onlineLife.service.impl
 * @author: HarryXzy
 * @create: 2022-04-15 17:37
 * @description:
 **/
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;
    /**
    * @author: HarryXzy
    * @date: 2022/4/15 5:40 下午
    * @return:
    * @description: 后台登陆
    **/
    @Override
    public User adminLogin(User user) {
        User u= userMapper.getUserByNameAndPwd(user.getName(),user.getPassword());
        if(u!=null){
            return u;
        }else{
            return null;
        }
    }

    @Override
    public boolean modUserById(User user) {
        return userMapper.updateUserById(user) > 0;
    }

    @Override
    public User queryUserById(Integer id) {
        return userMapper.selectUserById(id);
    }

}
